<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Creates a new DOMText object</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.domtext.html">DOMText</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="domtext.iswhitespaceinelementcontent.html">DOMText::isWhitespaceInElementContent</a></div>
 <div class="up"><a href="class.domtext.html">DOMText</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="domtext.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMText::__construct</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">DOMText::__construct</span> &mdash; <span class="dc-title">
   Creates a new <a href="class.domtext.html" class="classname">DOMText</a> object
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-domtext.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DOMText::__construct()</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Creates a new <a href="class.domtext.html" class="classname">DOMText</a> object.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-domtext.construct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">value</code></em></dt>

     <dd>

      <p class="para">
       The value of the text node. If not supplied an empty text node is created.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-domtext.construct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5313">
    <p><strong>Example #1 Creating a new DOMText</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$dom&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">(</span><span style="color: #DD0000">'1.0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'iso-8859-1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$element&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">appendChild</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">DOMElement</span><span style="color: #007700">(</span><span style="color: #DD0000">'root'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$element</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">appendChild</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">DOMText</span><span style="color: #007700">(</span><span style="color: #DD0000">'root&nbsp;value'</span><span style="color: #007700">));<br />echo&nbsp;</span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveXML</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">/*&nbsp;&lt;?xml&nbsp;version="1.0"&nbsp;encoding="iso-8859-1"?&gt;&lt;root&gt;root&nbsp;value&lt;/root&gt;&nbsp;*/<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-domtext.construct-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="domdocument.createtextnode.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createTextNode()</a> - Create new text node</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.domtext.html">DOMText</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="domtext.iswhitespaceinelementcontent.html">DOMText::isWhitespaceInElementContent</a></div>
 <div class="up"><a href="class.domtext.html">DOMText</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
